<?php

namespace App\Kuafu\Product\Service;

use App\Kuafu\Base\Service\BaseService;
use App\Kuafu\Order\Enum\OrderCodeEnum;
use App\Kuafu\Order\Enum\OrderMerchantEnum;
use App\Kuafu\Order\Exceptions\OrderException;
use App\Kuafu\WaiMai\Service\WaiMaiProductService;

class MerchantProductService extends BaseService
{
    /**
     * 店铺下的的菜品列表 - 根据订单类型查询
     * @param int $orderType
     * @param int $shopId
     */
    public static function getShopProductsByOrderType(int $orderType, int $shopId)
    {
        switch ($orderType) {
            case OrderMerchantEnum::ORDER_TYPE_IN:

                // 堂食
                $lists = ProductService::getShopProducts($shopId);
                break;

            case OrderMerchantEnum::ORDER_TYPE_WAI_MAI:

                // 外卖
                $lists = WaiMaiProductService::getShopProducts($shopId);
                break;

            default:
                throw new OrderException(OrderCodeEnum::ERR_ORDER_IN_OUT_TYPE);
        }

        return $lists;
    }
}
